package com.gui.base;

import java.math.BigDecimal;

public class BigDecimalDemo {

    public static void main(String[] args) {
        float a = 2.0f - 1.9f;
        float b = 1.8f - 1.7f;
        BigDecimal aBig = new BigDecimal(String.valueOf(a));
        BigDecimal bBig = new BigDecimal(b);
        System.out.println(a);
        System.out.println(b);
        System.out.println(aBig);
        System.out.println(bBig);


        System.out.println("====================================");

        BigDecimal debit = new BigDecimal("2.0");
        BigDecimal credit = new BigDecimal("1.9");
        BigDecimal result = debit.subtract(credit);
        System.out.println(result);

        System.out.println("====================================");


        BigDecimal debit1 = BigDecimal.valueOf(2.0f);
        BigDecimal credit1 = BigDecimal.valueOf(1.9f);
        double result1 = debit1.subtract(credit1).doubleValue();
        System.out.println(result1);

    }
}
